import http from '../utils/request'

export enum MiaoInstructCode {
    // eslint-disable-next-line no-unused-vars
    CPU = 1000,
    CPUPercent,
    Memory,

}

export interface SearchDevice {
    page: number;
    pageSize: number;
    ip: string;
    hostname: string;
}

export interface MiaoClient {
    deviceID: string;
    mainBoardSerial: string;
    hardDiskSerial: string;
    activeMAC: string;
    IP: string;
    hostname: string;
    createdAt: number;
    isOverlap: boolean;
}

export interface MiaoClientPage {
    list: MiaoClient[];
    total: number;
}

// 获取miao终端分页信息
export const getMiaoClientPage = (data: SearchDevice): Promise<MiaoClientPage> => {
  return http.get('/device/page', { params: data })
}

// 获取miao终端详情信息
export const getMiaoClientDetail = (id: string, infoType: string): Promise<any> => {
  return http.get('/device/detail', { params: { id, infoType } })
}

export const SendInstruct = (deviceId: string, code: number, body: any): Promise<any> => {
  return http.post('/device/SendInstruct', { deviceId, code, body })
}
